//
//  ALPListenListDetailsCell.m
//  AlpFM
//
//  Created by dllo on 16/2/27.
//  Copyright © 2016年 Alp. All rights reserved.
//

#import "ALPListenListDetailsCell.h"

@interface ALPListenListDetailsCell ()
@property (nonatomic, strong) UIImageView *myImage;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *describeLabel;
@property (nonatomic, strong) UIImageView *xixian;//细线


@end

@implementation ALPListenListDetailsCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creat];
    }
    return self;
}
-(void)creat{
    self.myImage = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 60, 60)];
    self.myImage.layer.masksToBounds = YES;
    self.myImage.layer.cornerRadius = self.myImage.bounds.size.width *0.5;
    self.myImage.layer.borderWidth = 4.0;
    self.myImage.layer.borderColor = [UIColor whiteColor].CGColor;
    [self.contentView addSubview:self.myImage];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(80, 10, 230, 50)];
    self.describeLabel.font = [UIFont boldSystemFontOfSize:16];
    self.titleLabel.numberOfLines = 0;
    [self.contentView addSubview:self.titleLabel];
    
    self.describeLabel = [[UILabel alloc]initWithFrame:CGRectMake(80, 59, 260, 15)];
    self.describeLabel.font = [UIFont boldSystemFontOfSize:14];
    self.describeLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.describeLabel];

    self.xixian = [[UIImageView alloc]initWithFrame:CGRectMake(80, 75, 293, 3)];
    self.xixian.image = [UIImage imageNamed:@"xixian"];
    [self.contentView addSubview:self.xixian];
}


-(void)setMol:(ALPListenListDetailModelList *)mol{
    _mol = mol;
    [self.myImage sd_setImageWithURL:[NSURL URLWithString:_mol.coverSmall] placeholderImage:nil];
    self.titleLabel.text = _mol.title;
    if (_mol.nickname.length == 0) {
        self.describeLabel.text = _mol.intro;
        [self.myImage sd_setImageWithURL:[NSURL URLWithString:_mol.albumCoverUrl290] placeholderImage:nil];
    }else{
    NSString *str = [@"by " stringByAppendingString:_mol.nickname];
    self.describeLabel.text = str;
    }
//    NSInteger strlength = 0;
//    char* p = (char*)[str cStringUsingEncoding:NSUnicodeStringEncoding];
//    for (int i=0 ; i<[str lengthOfBytesUsingEncoding:NSUnicodeStringEncoding] ;i++) {
//        if (*p) {
//            p++;
//            strlength++;
//        }
//        else {
//            p++;
//        }
//        
//    }
    
   
    
    
}








- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
